package io操作;

import java.io.FileInputStream;
import java.io.IOException;

public class 文件读取 {

    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("C:/Test/1.txt");
//        FileInputStream fis = new FileInputStream(new File("C:/Test/1.txt"));

        byte[] bytes = new byte[fis.available()];
        int b;
        //不停的读，一直读到输入流结束（文件结束）

        for(int i=0; (b = fis.read()) != -1; i++){
            bytes[i] = (byte) b;
        }
        System.out.println(new String(bytes, "UTF-8"));
    }
}
